import java.util.*;

/**
 * @author LKQ
 * @date 2022/5/15 10:10
 * @description 前缀和
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int waysToSplitArray(int[] nums) {
        int n = nums.length;
        // 注意溢出问题，用long保存
        long[] pre = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            pre[i] = pre[i-1] + nums[i-1];
        }
        int ans = 0;
        for (int i = 0; i < n - 1; i++) {
            if (2 * pre[i + 1] >= pre[n]) {
                ans++;
            }
        }
        return ans;
    }
}
